package com.study.repository;

import com.study.entity.Student;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Classname UsersDao
 * @Version 1.0.0
 * @Date 2022/4/2 23:31
 * @Created by yd
 */
@Repository
public interface StudentRepository extends BaseRepository<Student, Long> {

	@Query(value = "from Student where name=:name")
	List<Student> getStudent(@Param("name") String name);

	@Transactional
	@Modifying
	@Query(value = "update Student t set t.name=:name where t.id=:id")
	int updateStudent(@Param("name") String name, @Param("id") Long id);


	// QueryByExampleExecutor


}
